package cn.lsnu.modules.check.service;

import cn.lsnu.common.interfacetools.interfaceentity.Page;
import cn.lsnu.common.interfacetools.interfaceservice.BaseService;
import cn.lsnu.modules.check.entity.OutCheckEntity;
import cn.lsnu.modules.check.mapper.OutCheckMapper;
import cn.lsnu.utils.Guuid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class OutCheckService extends BaseService<OutCheckEntity,OutCheckMapper> {


    @Autowired
    private OutCheckMapper outCheckMapper;

    @Override
    public void save(OutCheckEntity entity) throws Exception {
        entity.setCheckDate(new Date());
        super.save(entity);
    }

    @Override
    public OutCheckEntity get(String key) throws Exception {
        return super.get(key);
    }

    @Override
    public OutCheckEntity getEntity(OutCheckEntity entity) throws Exception {
        return super.getEntity(entity)==null?new OutCheckEntity():super.getEntity(entity);
    }

    @Override
    public List<OutCheckEntity> findList(OutCheckEntity entity) throws Exception {
        return super.findList(entity);
    }

    @Override
    public Page<OutCheckEntity> findPage(OutCheckEntity entity) throws Exception {
        return super.findPage(entity);
    }

    @Override
    public void delete(OutCheckEntity entity) throws Exception {
        super.delete(entity);
    }

    @Override
    public void update(OutCheckEntity entity) throws Exception {
        entity.setCheckDate(new Date());
        super.update(entity);
    }

    public OutCheckEntity getOut(String key)throws Exception{
        return outCheckMapper.getOut(key);
    }
}
